package com.hfy.admin.controller;

import com.hfy.admin.service.ApprovalService;
import com.hfy.model.dto.admin.ApprovalAlbumApplyDto;
import com.hfy.model.dto.admin.ApprovalMusicApplyDto;
import com.hfy.model.dto.admin.ApprovalMusicianApplyDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import result.Result;

import java.time.LocalDateTime;

/**
 * @ author 韩
 * time: 2024/12/24 12:57
 */

@RestController
@RequestMapping("/approval")
@Tag(name = "审批操作控制器" ,description = "主要是对各种申请操作进行一些处理")
public class ApprovalController {

    @Autowired
    private ApprovalService approvalService;

    @GetMapping("/musician/page")
    @Operation(summary = "分页查询音乐人申请信息",description = "可以筛选查询")
    @Parameters({@Parameter(name = "status",description = "筛选条件-状态"),
            @Parameter(name = "type",description = "筛选条件-类型"),
            @Parameter(name = "area",description = "筛选条件-地区"),
            @Parameter(name = "page",description = "目前的页数"),
            @Parameter(name = "size",description = "分页大小")
    })
    public Result queryMusicianPages(
            @RequestParam(value = "status", required = false) Integer status,
            @RequestParam(value = "type", required = false) String type,
            @RequestParam(value = "area", required = false) String area,
            @RequestParam(value = "page", defaultValue = "1") int page,
            @RequestParam(value = "size", defaultValue = "10") int size) {
        return approvalService.queryMusicianPages(status, type, area, page, size);
    }
    @GetMapping("/album/page")
    @Operation(summary = "分页查询音乐人申请信息",description = "可以筛选查询")
    @Parameters({@Parameter(name = "status",description = "筛选条件-状态"),
            @Parameter(name = "styleId",description = "筛选条件-专辑风格"),
            @Parameter(name = "startDate",description = "筛选条件-截至时间"),
            @Parameter(name = "endDate",description = "筛选条件-类型"),
            @Parameter(name = "page",description = "目前的页数"),
            @Parameter(name = "size",description = "分页大小")
    })
    public Result queryAlbumPages(
            @RequestParam(value = "status", required = false) Integer status,
            @RequestParam(value = "styleId", required = false) Integer styleId,
            @RequestParam(value = "startDate", required = false) LocalDateTime startDate,
            @RequestParam(value = "endDate", required = false) LocalDateTime endDate,
            @RequestParam(value = "page", defaultValue = "1") int page,
            @RequestParam(value = "size", defaultValue = "10") int size) {
        return approvalService.queryAlbumPages(status, styleId, startDate, endDate, page, size);
    }

    @PutMapping("/musician/do")
    @Operation(summary = "执行音乐人处理逻辑",description = "根据不同参数，也就是处理操作的不同，执行不同逻辑")
    @Parameters({
            @Parameter(name = "id",description = "申请id"),
            @Parameter(name = "toStatus",description = "想要变成的状态"),
            @Parameter(name = "des",description = "处理备注")})
    public Result approvalMusicianApply(@RequestBody ApprovalMusicianApplyDto dto) {
        return approvalService.approvalMusicianApply(dto);
    }

    @PutMapping("/album/do")
    @Operation(summary = "执行专辑处理逻辑",description = "根据不同参数，也就是处理操作的不同，执行不同逻辑")
    @Parameters({
            @Parameter(name = "id",description = "申请专辑的请求id"),
            @Parameter(name = "toStatus",description = "想要变成的状态"),
            @Parameter(name = "des",description = "处理备注")})
    public Result approvalAlbumApply(@RequestBody ApprovalAlbumApplyDto dto) {
        return approvalService.approvalAlbumApply(dto);
    }


    @PutMapping("/music/do")
    @Operation(summary = "执行专辑附属音乐处理逻辑",description = "根据不同参数，也就是处理操作的不同，执行不同逻辑")
    @Parameters({
            @Parameter(name = "id",description = "申请id"),
            @Parameter(name = "toStatus",description = "想要变成的状态"),
            @Parameter(name = "des",description = "处理备注")})
    public Result approvalMusicApply(@RequestBody ApprovalMusicApplyDto dto) {
        return approvalService.approvalMusicApply(dto);
    }






}
